USE [master]
GO

/****** Object:  Database [CarSpider]    Script Date: 09/10/2010 12:52:32 ******/
CREATE DATABASE [CarSpider] ON  PRIMARY 
( NAME = N'CarSpider', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQL2008\MSSQL\DATA\CarSpider.mdf' , SIZE = 10240KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'CarSpider_log', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQL2008\MSSQL\DATA\CarSpider_log.ldf' , SIZE = 15040KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO

ALTER DATABASE [CarSpider] SET COMPATIBILITY_LEVEL = 100
GO

IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [CarSpider].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO

ALTER DATABASE [CarSpider] SET ANSI_NULL_DEFAULT OFF 
GO

ALTER DATABASE [CarSpider] SET ANSI_NULLS OFF 
GO

ALTER DATABASE [CarSpider] SET ANSI_PADDING OFF 
GO

ALTER DATABASE [CarSpider] SET ANSI_WARNINGS OFF 
GO

ALTER DATABASE [CarSpider] SET ARITHABORT OFF 
GO

ALTER DATABASE [CarSpider] SET AUTO_CLOSE OFF 
GO

ALTER DATABASE [CarSpider] SET AUTO_CREATE_STATISTICS ON 
GO

ALTER DATABASE [CarSpider] SET AUTO_SHRINK OFF 
GO

ALTER DATABASE [CarSpider] SET AUTO_UPDATE_STATISTICS ON 
GO

ALTER DATABASE [CarSpider] SET CURSOR_CLOSE_ON_COMMIT OFF 
GO

ALTER DATABASE [CarSpider] SET CURSOR_DEFAULT  GLOBAL 
GO

ALTER DATABASE [CarSpider] SET CONCAT_NULL_YIELDS_NULL OFF 
GO

ALTER DATABASE [CarSpider] SET NUMERIC_ROUNDABORT OFF 
GO

ALTER DATABASE [CarSpider] SET QUOTED_IDENTIFIER OFF 
GO

ALTER DATABASE [CarSpider] SET RECURSIVE_TRIGGERS OFF 
GO

ALTER DATABASE [CarSpider] SET  DISABLE_BROKER 
GO

ALTER DATABASE [CarSpider] SET AUTO_UPDATE_STATISTICS_ASYNC OFF 
GO

ALTER DATABASE [CarSpider] SET DATE_CORRELATION_OPTIMIZATION OFF 
GO

ALTER DATABASE [CarSpider] SET TRUSTWORTHY OFF 
GO

ALTER DATABASE [CarSpider] SET ALLOW_SNAPSHOT_ISOLATION OFF 
GO

ALTER DATABASE [CarSpider] SET PARAMETERIZATION SIMPLE 
GO

ALTER DATABASE [CarSpider] SET READ_COMMITTED_SNAPSHOT OFF 
GO

ALTER DATABASE [CarSpider] SET HONOR_BROKER_PRIORITY OFF 
GO

ALTER DATABASE [CarSpider] SET  READ_WRITE 
GO

ALTER DATABASE [CarSpider] SET RECOVERY FULL 
GO

ALTER DATABASE [CarSpider] SET  MULTI_USER 
GO

ALTER DATABASE [CarSpider] SET PAGE_VERIFY CHECKSUM  
GO

ALTER DATABASE [CarSpider] SET DB_CHAINING OFF 
GO



USE [CarSpider]
GO

/****** Object:  Table [dbo].[CSBrand]    Script Date: 09/10/2010 12:53:24 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[CSBrand](
	[Id] [int] NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[IsDelete] [int] NOT NULL,
 CONSTRAINT [PK_CSBrand] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[CSBrand] ADD  CONSTRAINT [DF_CSBrand_IsDelete]  DEFAULT ((0)) FOR [IsDelete]
GO


USE [CarSpider]
GO

/****** Object:  Table [dbo].[CSCarType]    Script Date: 09/10/2010 12:53:41 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[CSCarType](
	[Id] [int] NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[BrandID] [int] NOT NULL,
	[IsDelete] [int] NOT NULL,
 CONSTRAINT [PK_CSCarType] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[CSCarType]  WITH CHECK ADD  CONSTRAINT [FK_CSCarType_CSBrand] FOREIGN KEY([BrandID])
REFERENCES [dbo].[CSBrand] ([Id])
GO

ALTER TABLE [dbo].[CSCarType] CHECK CONSTRAINT [FK_CSCarType_CSBrand]
GO

ALTER TABLE [dbo].[CSCarType] ADD  CONSTRAINT [DF_CSCarType_IsDelete]  DEFAULT ((0)) FOR [IsDelete]
GO


USE [CarSpider]
GO

/****** Object:  Table [dbo].[CSCarInfo]    Script Date: 09/10/2010 12:54:17 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[CSCarInfo](
	[Id] [int] NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[Image] [image] NOT NULL,
	[Type] [nvarchar](50) NOT NULL,
	[CarTypeId] [int] NOT NULL,
	[Price] [float] NOT NULL,
	[IsDelete] [int] NOT NULL,
 CONSTRAINT [PK_CSCarInfo] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

ALTER TABLE [dbo].[CSCarInfo]  WITH CHECK ADD  CONSTRAINT [FK_CSCarInfo_CSCarType] FOREIGN KEY([CarTypeId])
REFERENCES [dbo].[CSCarType] ([Id])
GO

ALTER TABLE [dbo].[CSCarInfo] CHECK CONSTRAINT [FK_CSCarInfo_CSCarType]
GO

ALTER TABLE [dbo].[CSCarInfo] ADD  CONSTRAINT [DF_CSCarInfo_IsDelete]  DEFAULT ((0)) FOR [IsDelete]
GO


